<?php
include 'syntaxhighlight/geshi.php';
function syntax_highlight($input) {
  $final = "";
  $split = split("}}}",$input);
  for($i=0; $i<count($split)-1; $i++) {
    $segment = $split[$i];
    $split2 = split("{{{",$segment);
    $final .= $split2[0];
    $split3 = split("\n",$split2[1]);
    $language = $split3[0];
    $code = $split3;
    array_pop($code);
    array_shift($code);
    $code = implode("\n",$code);
    $geshi = new GeSHi($code,$language);
    $final .= '<notextile>'.$geshi->parse_code().'</notextile>';
  }
  $final .= $split[count($split)-1];
  return $final;
}
add_filter('post_body','syntax_highlight');
?>